home *** CD-ROM | disk | FTP | other *** search
/ Windows 6-Pak - Disc 4 / Windows 6-Pak (InfoMagic) (Disc 4) (1999).ISO / Text-Chat-Scripts / pp-320m.exe / pp300 / a-main4.mrc < prev    next >
Text File  |  1998-08-16  |  28KB  |  587 lines

  1. ; -----------------------------------------------------
  2. ; Peace and Protection (by misspai)
  3. ; -----------------------------------------------------
  4. ; Main (normal) aliases
  5. ; (Fourth section)
  6. ; -----------------------------------------------------
  7. ; ICMP/etc. detection
  8. ; -----------------------------------------------------
  9. netstat if (3.1 isin $os) _error Sorry, the attack detectors do not work properly on Windows 3.11 | dispa Detecting attack statistics... | run -n $_ppdir $+ do-ns.bat $ddename $_ppdir /_nsdone -s
  10. icmp netstat
  11. _nsdone {
  12.   set %.file $_ppdir $+ ns-temp.txt
  13.   if ($lines(%.file) < 55) _error Error running NETSTAT.EXE!
  14.   set %.vars frag1.frag2.frag3.frag4.frag5.frag6.nuke1.nuke2.nuke3.nuke4.nuke5.echo1.echo2.echo3.echo4.echo5.echo6.udp1.udp2.udp3.udp4
  15.   set %.lines 15.16.17.18.19.20.27.28.29.30.31.32.33.34.35.36.37.52.53.54.55
  16.   set %.toks 4.4.4.5.5.4.3.3.3.3.2.2.4.2.4.3.5.4.4.4.4
  17.   set %.num 22
  18.   :loop
  19.   set %.get $read -nl [ $+ [ $gettok(%.lines,%.num,46) ] ] %.file
  20.   set %.ns. [ $+ [ $gettok(%.vars,%.num,46) ] ] $gettok(%.get,$gettok(%.toks,%.num,46),32)
  21.   if ($_vd(.num) > 0) goto loop
  22.   window -c @Attack
  23.   window -l $_tabscale(5,9) @Attack $_winpos(35%,35%,5%,5%) @Close %font.basic
  24.   titlebar @Attack detection - Nuke, ICMP, UDP Flood, SSPing
  25.   aline @Attack Nuke    detect    - %col.target $+ $calc(%.ns.nuke1 + %.ns.nuke2 + %.ns.nuke3 + %.ns.nuke4 + %.ns.nuke5) $+  unreach/error packets
  26.   aline @Attack ICMP    detect    - %col.target $+ $calc(%.ns.echo1 + %.ns.echo3 + %.ns.echo5) $+  echos received, %col.target $+ $calc(%.ns.echo2 + %.ns.echo4 + %.ns.echo6) $+  replied to
  27.   aline @Attack UDP    detect    - %col.target $+ %.ns.udp1 $+  datagrams received, %col.target $+ %.ns.udp4 $+  sent, %col.target $+ $calc(%.ns.udp2 + %.ns.udp3) $+  errors
  28.   aline @Attack SSPing    detect    - %col.target $+ $calc(%.ns.frag1 + %.ns.frag2 + %.ns.frag3 + %.ns.frag4 + %.ns.frag5 + %.ns.frag6) $+  fragmented packets
  29. }
  30. detect if (3.1 isin $os) _error Sorry, the attack detectors do not work properly on Windows 3.11 | unset %_detect.* %_dwarn.* | if ($1 == $null) set %_detect.sec 5 | else set %_detect.sec $1 | if ($2 == $null) set %_detect.max 5 | else set %_detect.max $2 | if ($3 == $null) set %_detect.sens 2 | else set %_detect.sens $3 | set %.delay $calc(%_detect.sec * 1000) | run -n $_ppdir $+ loop-ns.bat $ddename $_ppdir /_nsloop %.delay -s
  31. _nsloop {
  32.   set %.file $_ppdir $+ ns-temp.txt
  33.   if ($lines(%.file) < 55) _error Error running NETSTAT.EXE!
  34.   set %.vars frag1.frag2.frag3.frag4.frag5.frag6.nuke1.nuke2.nuke3.nuke4.nuke5.echo1.echo2.echo3.echo4.echo5.echo6.udp1.udp2.udp3.udp4
  35.   set %.lines 15.16.17.18.19.20.27.28.29.30.31.32.33.34.35.36.37.52.53.54.55
  36.   set %.toks 4.4.4.5.5.4.3.3.3.3.2.2.4.2.4.3.5.4.4.4.4
  37.   set %.num 21
  38.   :loop
  39.   set %.get $read -nl [ $+ [ $gettok(%.lines,%.num,46) ] ] %.file
  40.   set %.ns. [ $+ [ $gettok(%.vars,%.num,46) ] ] $gettok(%.get,$gettok(%.toks,%.num,46),32)
  41.   if ($_vd(.num) > 0) goto loop
  42.   if ($window(@Attack) == $null) {
  43.     window -l $_tabscale(5,9) @Attack $_winpos(35%,35%,5%,5%) @Close %font.basic
  44.     titlebar @Attack detection - Nuke, ICMP, UDP Flood, SSPing
  45.   }
  46.   set %.unreach $calc(%.ns.nuke1 + %.ns.nuke2 + %.ns.nuke3 + %.ns.nuke4 + %.ns.nuke5)
  47.   set %.echo1 $calc(%.ns.echo1 + %.ns.echo3 + %.ns.echo5)
  48.   set %.echo2 $calc(%.ns.echo2 + %.ns.echo4 + %.ns.echo6)
  49.   set %.udperr $calc(%.ns.udp2 + %.ns.udp3)
  50.   set %.gibs $calc(%.ns.frag1 + %.ns.frag2 + %.ns.frag3 + %.ns.frag4 + %.ns.frag5 + %.ns.frag6)
  51.   set %.max $calc(%_detect.sec * %_detect.max)
  52.   set %.col.ok $remove(%col.target,) $+ 
  53.   set %.col.warn $remove(%col.att,) $+ 
  54.   if (%_detect.n == $null) {
  55.     set %_detect.n %.unreach
  56.     set %_detect.i1 %.echo1
  57.     set %_detect.i2 %.echo2
  58.     set %_detect.u1 %.ns.udp1
  59.     set %_detect.u2 %.ns.udp4
  60.     set %_detect.u3 %.udperr
  61.     set %_detect.g %.gibs
  62.   }
  63.   unset %.warn %.swt
  64.   if ($calc(%.ns.udp1 - %_detect.u1) > %.max) { set %.col.u1 %.col.warn | set %.swt -h }
  65.   else set %.col.u1 %.col.ok
  66.   if ($calc(%.ns.udp4 - %_detect.u2) > %.max) { set %.col.u2 %.col.warn | set %.swt -h }
  67.   else set %.col.u2 %.col.ok
  68.   if ($calc(%.udperr - %_detect.u3) > %.max) { inc %_dwarn.u | set %.swt -h | if (%_dwarn.u == %_detect.sens) set %.warn UDP flood | set %.col.u3 %.col.warn }
  69.   else { set %.col.u3 %.col.ok | unset %_dwarn.u3 }
  70.   if ($calc(%.unreach - %_detect.n) > %.max) { inc %_dwarn.n | set %.swt -h | if (%_dwarn.n == %_detect.sens) set %.warn Nuke attack | set %.col.n %.col.warn }
  71.   else { set %.col.n %.col.ok | unset %_dwarn.n }
  72.   if ($calc(%.echo1 - %_detect.i1) > %.max) { inc %_dwarn.i | set %.swt -h | if (%_dwarn.i == %_detect.sens) set %.warn ICMP flood | set %.col.i1 %.col.warn }
  73.   else { set %.col.i1 %.col.ok | unset %_dwarn.i }
  74.   if ($calc(%.echo2 - %_detect.i2) > %.max) { set %.col.i2 %.col.warn | set %.swt -h }
  75.   else set %.col.i2 %.col.ok
  76.   if ($calc(%.gibs - %_detect.g) > %.max) { inc %_dwarn.g | set %.swt -h | if (%_dwarn.g == %_detect.sens) set %.warn SSPing attack | set %.col.g %.col.warn }
  77.   else { set %.col.g %.col.ok | unset %_dwarn.g }
  78.   rline %.swt @Attack 1 Nuke    detect    - %.col.n $+ %.unreach $+  unreach/error packets
  79.   rline @Attack 2 ICMP    detect    - %.col.i1 $+ %.echo1 $+  echos received, %.col.i2 $+ %.echo2 $+  replied to
  80.   rline @Attack 3 UDP    detect    - %.col.u1 $+ %.ns.udp1 $+  datagrams received, %.col.u2 $+ %.ns.udp4 $+  sent, %.col.u3 $+ %.udperr $+  errors
  81.   rline @Attack 4 SSPing    detect    - %.col.g $+ %.gibs $+  fragmented packets
  82.   set %_detect.n %.unreach
  83.   set %_detect.i1 %.echo1
  84.   set %_detect.i2 %.echo2
  85.   set %_detect.u1 %.ns.udp1
  86.   set %_detect.u2 %.ns.udp4
  87.   set %_detect.u3 %.udperr
  88.   set %_detect.g %.gibs
  89.   if (%.warn != $null) {
  90.     window -ar @Attack
  91.     window -do +fn @Alert $_center(500,100,d) 500 100 @Close %font.quick
  92.     aline @Alert %.col.warn $+ ALERT-
  93.     aline %col.cdark @Alert  $+ You may be under attack-
  94.     aline %col.cdark @Alert  $+ A possible %.warn has been detected.
  95.     beep 1 1
  96.   }
  97. }
  98. ; -----------------------------------------------------
  99. ; Nuke protection
  100. ; -----------------------------------------------------
  101. portup {
  102.   if (%_pupamt != $null) _error A PortUp is already in progress, please wait until it is finished before issuing another.
  103.   if ($bits == 16) _error Sorry, the port upper will not run if you're using 16-bit mIRC.
  104.   if ($1 == $null) _quickhelp /portup
  105.   dispa Increasing local port by %col.target $+ $1 $+ ...
  106.   set %_pupamt $1
  107.   set %.ini $_ppdir $+ m-portup.ini
  108.   set %.ini2 $_ppdir $+ portup1.ini
  109.   writeini %.ini2 script n2 dde $ddename command "" /_pu.loaded
  110.   writeini %.ini2 aliases n7 dde $ddename command "" /_pu.done
  111.   run -n mirc32 -i $+ %.ini
  112. }
  113. _pu.loaded dde PortUp command "" /portup %_pupamt $ip
  114. _pu.done {
  115.   dispa Portup complete- Local port has been increased by %col.target $+ %_pupamt $+ .
  116.   dispa You must reconnect to IRC to use this new local port.
  117.   unset %_pupamt
  118. }
  119. ; -----------------------------------------------------
  120. ; Repeated rejoin
  121. ; -----------------------------------------------------
  122. repjoin {
  123.   if ($1 == $null) _quickhelp /repjoin
  124.   if ($1 isin -v) { if (%_repjoins == $null) dispa Not currently attempting any repeated joins. | else dispa Currently attempting repeated joins of- %col.target $+ $_s2cs(%_repjoins) | return }
  125.   if ($1 isin -c) { unset %_repjoins | .timer902 off | dispa All repeated join attempts canceled. | return }
  126.   set %.chan $_patch($1)
  127.   if (%.chan ischan) _error You are already on  $+ %.chan $+ !
  128.   if ($findtok(%_repjoins,%.chan,32)) {
  129.     dispa Canceled repeated join attempt of %col.target $+ %.chan $+ .
  130.     set %_repjoins $remtok(%_repjoins,%.chan,32)
  131.     return
  132.   }
  133.   disps Repeated attempts to join %col.target $+ %.chan $+  will be made, quietly, until you are let in.
  134.   set %_repjoins $addtok(%_repjoins,%.chan,32)
  135.   .timer902 -o 0 20 _borkbork
  136.   _borkbork
  137. }
  138. _borkbork {
  139.   if (%_repjoins == $null) { .timer902 off | halt }
  140.   if ($server == $null) halt
  141.   .raw join $_s2c(%_repjoins) $_keys(%_repjoins)
  142. }
  143. ; -----------------------------------------------------
  144. ; Alarms (self-made)
  145. ; -----------------------------------------------------
  146. _d.alarm {
  147.   _title ALARM
  148.   window -adox @Alarm 0 0 $window(-1).w $window(-1).h @Close Arial 740
  149.   titlebar @Alarm activated
  150.   aline %col.cdark @Alarm %col.att $+ ALARM activated
  151.   aline @Alarm $chr(160)
  152.   aline @Alarm %col.att $+ Message-
  153.   beep 1 1
  154.   echo $remove(%col.cdark,-c) @Alarm $1-
  155.   .timer919 -om 0 100 _chkalrm
  156. }
  157. _s.alarm splay $_p2s($1) | _d.alarm $2-
  158. _chkalrm if ($active != @Alarm) { window -c @Alarm | .timer919 off }
  159. alarm {
  160.   if ($2 == $null) _quickhelp /alarm
  161.   if (: isin $1) {
  162.     if ($right($1,1) isin ap) {
  163.       set %.hour $gettok($1,1,58)
  164.       set %.minute $remove($remove($gettok($1,2,58),p),a)
  165.       if (%.hour == 12) set %.hour 0
  166.       if ($right($1,1) == p) set %.hour $calc(%.hour + 12)
  167.       set %.time %.hour $+ : $+ %.minute 1 1
  168.     }
  169.     else set %.time $1 1 1
  170.   }
  171.   elseif (s isin $1) set %.time 1 $remove($1,s)
  172.   else set %.time 1 $calc($remove($1,m) * 60)
  173.   set %.ext $_rtok(1,46,$2)
  174.   if ((($len(%.ext) == 2) || ($len(%.ext) == 3)) && (. isin $2)) {
  175.     dispa Alarm activated- Message %col.dark $+ " $+ $3- $+ ", sound %col.dark $+ $_p2s($2)
  176.     _timer800 -o %.time _s.alarm $2-
  177.   }
  178.   else {
  179.     dispa Alarm activated- Message %col.dark $+ " $+ $2- $+ "
  180.     _timer800 -o %.time _d.alarm $2-
  181.   }
  182. }
  183. _timer800 {
  184.   set %.ttt $timer(0)
  185.   if (%.ttt == 0) { timer800 $1- | dispa Message or Alarm enabled; type /timer800 off to disable. | return }
  186.   :loop
  187.   if ($timer(%.ttt) isnum 800-898) { timer [ $+ [ $_i($timer(%.ttt)) ] ] $1- | dispa Message or Alarm enabled; type /timer $+ $_i($timer(%.ttt)) off to disable. | return }
  188.   dec %.ttt
  189.   if (%.ttt > 0) goto loop
  190.   timer800 $1- | dispa Message or Alarm enabled; type /timer800 off to disable.
  191. }
  192. ; -----------------------------------------------------
  193. ; Find a user after they change
  194. ; nicknames
  195. ; -----------------------------------------------------
  196. finduser if ($1 == $null) _quickhelp /finduser | set %-+findingu. [ $+ [ $1 ] ] $true | .raw whowas $1 | dispa Attempting to find new nickname of %col.target $+ $1 $+  (if they didn't leave IRC)
  197. _fuser2 set %.targ %-+findingu. [ $+ [ $1 ] ] | set %.targ2 %.targ $+ @ $+ $2 | set %-+findingu. [ $+ [ $1 ] ] | dispa %col.target $+ $1 $+  user info found, attempting to locate user using a /ping | set %-+findping. [ $+ [ %.targ ] ] %.targ2 | set %-+findpingn. [ $+ [ %.targ ] ] $1 | _qc %.targ2 PING 00 $+ $ticks | .timer 1 10 sping $2 ! $+ %.targ $+ ! $+ $1
  198. ; -----------------------------------------------------
  199. ; Botlist
  200. ; -----------------------------------------------------
  201. botlist {
  202.   if ($1 == $null) _quickhelp /botlist
  203.   if ($_ischan($1)) { set %.b.chan $1 | goto botview }
  204.   if (v isin $1) {
  205.     :botview
  206.     if ($_ischan($2)) set %.b.chan $2 | else set %.b.chan *
  207.     open @Info /botlist Botlist
  208.     if (%autobot.chans == $null) { dispr @Info No bots have been defined for any channels. | return }
  209.     if (%.b.chan == *) set %.b.num 1
  210.     else {
  211.       set %.b.num $findtok(%autobot.chans,%.b.chan,32)
  212.       if (%.b.num == $null) { dispr @Info No bots have been defined for %col.target $+ %.b.chan $+ . | return }
  213.     }
  214.     :loop1
  215.     set %.b.ch $gettok(%autobot.chans,%.b.num,32)
  216.     if (%.b.ch == $null) return
  217.     set %.b.flag %autobot. [ $+ [ %.b.ch ] ]
  218.     if (join isin %.b.flag) set %.b.spec (ops autorequested on join)
  219.     else unset %.b.spec
  220.     dispr @Info Botlist for %col.target $+ %.b.ch $+ - %.b.spec
  221.     set %.b.botn 1
  222.     set %.b.pre autobot. $+ %.b.ch $+ .
  223.     :loop2
  224.     set %.b.pre2 %.b.pre $+ %.b.botn
  225.     set %.b.mask % [ $+ [ %.b.pre2 ] ]
  226.     if (%.b.mask == $null) goto nextch
  227.     set %.b.type $gettok(%.b.mask,2-,47)
  228.     set %.b.serv $gettok(%.b.mask,2-,36)
  229.     set %.b.mask $gettok($gettok(%.b.mask,1,47),1,36)
  230.     set %.b.serv $gettok(%.b.serv,1,47)
  231.     if (%.b.type != $null) set %.b.type - ( $+ %.b.type $+ )
  232.     if (%.b.serv == $null) set %.b.serv (any)
  233.     dispr @Info $chr(160) Botmask %col.info1 $+ %.b.mask $+  - Server %col.info1 $+ %.b.serv $+  %.b.type
  234.     set %.b.login $_ppcfg(%.b.pre2,login)
  235.     set %.b.opme $_ppcfg(%.b.pre2,opme)
  236.     set %.b.op $_ppcfg(%.b.pre2,op)
  237.     set %.b.topic $_ppcfg(%.b.pre2,topic)
  238.     set %.b.kick $_ppcfg(%.b.pre2,kick)
  239.     set %.b.ban $_ppcfg(%.b.pre2,ban)
  240.     set %.b.unban $_ppcfg(%.b.pre2,unban)
  241.     set %.b.list $chr(160) ò
  242.     if (%.b.login != $null) dispr @Info %.b.list Login command- %.b.login
  243.     if (%.b.opme != $null) dispr @Info %.b.list OpMe command- %.b.opme
  244.     if (%.b.op != $null) dispr @Info %.b.list Op command- %.b.op
  245.     if (%.b.deop != $null) dispr @Info %.b.list Deop command- %.b.deop
  246.     if (%.b.topic != $null) dispr @Info %.b.list Topic command- %.b.topic
  247.     if (%.b.kick != $null) dispr @Info %.b.list Kick command- %.b.kick
  248.     if (%.b.ban != $null) dispr @Info %.b.list Ban command- %.b.ban
  249.     if (%.b.unban != $null) dispr @Info %.b.list Unban command- %.b.unban
  250.     inc %.b.botn
  251.     goto loop2
  252.     :nextch
  253.     if (%.b.chan != * ) return
  254.     inc %.b.num
  255.     goto loop1
  256.   }
  257.   if ($_ischan($2)) set %.b.chan $2
  258.   else set %.b.chan *
  259.   if (%.b.chan == *) set %.b.disp %col.target $+ all channels
  260.   else set %.b.disp %col.target $+ %.b.chan $+ 
  261.   if (a isin $1) {
  262.     if (%.b.chan == *) _error You must specify a channel to add a botlist entry for.
  263.     if ($4 == $null) _error You must specify the bot's mask and password.
  264.     set %.b.scan 1 | unset %.b.new
  265.     :loop3
  266.     set %.b.pre autobot. $+ %.b.chan $+ . $+ %.b.scan
  267.     set %.b.old % [ $+ [ %.b.pre ] ]
  268.     if (%.b.old == $null) { set %.b.new $true | goto found }
  269.     if ($gettok($gettok(%.b.old,1,36),1,47) == $gettok($gettok($3,1,36),1,47)) goto found
  270.     inc %.b.scan | goto loop3
  271.     :found
  272.     dispa Botlist entry added/updated on %.b.disp for %col.info1 $+ $3
  273.     set %.b.pre autobot. $+ %.b.chan $+ . $+ %.b.scan
  274.     set % [ $+ [ %.b.pre ] ] $3
  275.     _writecfg %.b.pre pw $_pwenc($4)
  276.     set %autobot.chans $addtok(%autobot.chans,%.b.chan,32)
  277.     if (%.b.new) { set %.b.old %autobot. [ $+ [ %.b.chan ] ] | set %autobot. [ $+ [ %.b.chan ] ] %.b.scan $gettok(%.b.old,2-,32) }
  278.   }
  279.   elseif (j isin $1) {
  280.     if (%.b.chan == *) _error You must specify a channel to set op-on-join botlist flag for.
  281.     set %.b.old %autobot. [ $+ [ %.b.chan ] ]
  282.     if (%.b.old == $null) _error You must define one or more bots before you can set the op-on-join flag.
  283.     if ($3 isin onyesenabled$trueop) { set %.b.set (join) | dispa When you join %.b.disp $+ , you will attempt to get ops from a bot. }
  284.     else { unset %.b.set | dispa When you join %.b.disp you will not attempt to get ops using the botlist. }
  285.     set %autobot. [ $+ [ %.b.chan ] ] $gettok(%.b.old,1,32) %.b.set
  286.   }
  287.   elseif (d isin $1) {
  288.     if (%.b.chan == *) set %.b.chan %autobot.chans
  289.     set %.b.gah $_numtok(32,%.b.chan)
  290.     if ($3 == $null) dispa All botlist entries for %.b.disp deleted.
  291.     else dispa Botlist entry %col.dark $+ $3 $+  for %.b.disp deleted.
  292.     :loop4
  293.     set %.b.ch $gettok(%.b.chan,%.b.gah,32)
  294.     if ($3 == $null) {
  295.       set %.b.nums %autobot. [ $+ [ %.b.ch ] ]
  296.       set %.b.nums $gettok(%.b.nums,1,32)
  297.       :loop5
  298.       _botdel %.b.ch %.b.nums
  299.       if ($_vd(.b.nums) > 0) goto loop5
  300.     }
  301.     elseif ($3 isnum) _botdel %.b.ch $3
  302.     else {
  303.       set %.b.nums %autobot. [ $+ [ %.b.ch ] ]
  304.       set %.b.nums $gettok(%.b.nums,1,32)
  305.       :loop5
  306.       set %.b.var autobot. $+ %.b.ch $+ . $+ %.b.nums
  307.       set %.b.var % [ $+ [ %.b.var ] ]
  308.       if ($gettok($gettok(%.b.var,1,36),1,47) == $gettok($gettok($3,1,36),1,47)) _botdel %.b.ch %.b.nums
  309.       if ($_vd(.b.nums) > 0) goto loop5
  310.     }
  311.     if ($_vd(.b.gah) > 0) goto loop4
  312.   }
  313.   elseif (c !isin $1) _quickhelp /botlist
  314.   else {
  315.     if (%.b.chan == *) _error You must specify a channel to set botlist commands on
  316.     if ($3 == $null) _error You must specify a botmask to set botlist commands for
  317.     if ($5 == $null) _error You must specify the command to set
  318.     set %.b.bit $left($4,1)
  319.     if (%.b.bit == l) set %.b.cmd Login
  320.     elseif (%.b.bit == t) set %.b.cmd Topic
  321.     elseif (%.b.bit == k) set %.b.cmd Kick
  322.     elseif (%.b.bit == b) set %.b.cmd Ban
  323.     elseif (%.b.bit == u) set %.b.cmd Unban
  324.     elseif (%.b.bit == d) set %.b.cmd Deop
  325.     elseif ((me isin $4) || (%.b.bit == m)) set %.b.cmd OpMe
  326.     elseif (%.b.bit == o) set %.b.cmd Op
  327.     else _error Unknown botlist command " $+ $4 $+ "
  328.     if ($3 isnum) set %.b.num $3
  329.     else {
  330.       set %.b.num %autobot. [ $+ [ %.b.chan ] ]
  331.       set %.b.num $gettok(%.b.num,1,32)
  332.       :loop6
  333.       set %.b.var autobot. $+ %.b.chan $+ . $+ %.b.num
  334.       set %.b.var % [ $+ [ %.b.var ] ]
  335.       if ($gettok($gettok(%.b.var,1,36),1,47) != $gettok($gettok($3,1,36),1,47)) if ($_vd(.b.num) > 0) goto loop6
  336.     }
  337.     if ((%.b.num < 1) || (%.b.num > %autobot. [ $+ [ %.b.chan ] ] )) _error Unknown bot entry " $+ $3 $+ " for channel %.b.chan
  338.     set %.b.var autobot. $+ %.b.chan $+ . $+ %.b.num
  339.     _writecfg %.b.var %.b.cmd $5-
  340.     dispa Command %col.info1 $+ %.b.cmd $+  updated for bot.
  341.   }
  342. }
  343. _botdel {
  344.   set %.d.old %autobot. [ $+ [ $1 ] ]
  345.   set %.d.num $gettok(%.d.old,1,32)
  346.   if ($2 > %.d.num) return
  347.   set %.d.var autobot. $+ $1 $+ . $+ $2
  348.   if ($2 == %.d.num) {
  349.     set % [ $+ [ %.d.var ] ]
  350.     _remcfg %.d.var
  351.     if ($2 == 1) {
  352.       set %autobot. [ $+ [ $1 ] ]
  353.       set %autobot.chans $remtok(%autobot.chans,$1,32)
  354.     }
  355.     else set %autobot. [ $+ [ $1 ] ] $_j(%.d.num) $gettok(%.d.old,2-,32)
  356.   }
  357.   else {
  358.     set %.d.copy autobot. $+ $1 $+ . $+ %.d.num
  359.     set % [ $+ [ %.d.var ] ] % [ $+ [ %.d.copy ] ]
  360.     _writecfg %.d.var pw $_ppcfg(%.d.copy,pw)
  361.     _writecfg %.d.var login $_ppcfg(%.d.copy,login)
  362.     _writecfg %.d.var opme $_ppcfg(%.d.copy,opme)
  363.     _writecfg %.d.var op $_ppcfg(%.d.copy,op)
  364.     _writecfg %.d.var deop $_ppcfg(%.d.copy,deop)
  365.     _writecfg %.d.var topic $_ppcfg(%.d.copy,topic)
  366.     _writecfg %.d.var kick $_ppcfg(%.d.copy,kick)
  367.     _writecfg %.d.var ban $_ppcfg(%.d.copy,ban)
  368.     _writecfg %.d.var unban $_ppcfg(%.d.copy,unban)
  369.     set %autobot. [ $+ [ $1 ] ] $_j(%.d.num) $gettok(%.d.old,2-,32)
  370.     set % [ $+ [ %.d.copy ] ]
  371.     _remcfg %.d.copy
  372.   }
  373. }
  374. ; -----------------------------------------------------
  375. ; CD player
  376. ; -----------------------------------------------------
  377. cdini {
  378.   if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11
  379.   window -c @CDINI
  380.   window -nl @CDINI /_finishci %font.basic
  381.   _progress.1 Searching for CDPLAYER.INI... Please wait...
  382.   _progress.2 0 0% complete... (drive C:)
  383.   set %.fz.dr 99 | unset %.fz.found
  384.   :loop1
  385.   set %.fz.wh $chr(%.fz.dr) $+ :\
  386.   inc %.fz.found $findfile(%.fz.wh,cdplayer.exe,@CDINI)
  387.   if ($_vi(.fz.dr) <= 122) {
  388.     set %.fz.perc $int($calc((%.fz.dr - 99) * 100 / 24))
  389.     _progress.2 %.fz.perc %.fz.perc $+ % complete... (drive $upper($chr(%.fz.dr)) $+ :)
  390.     goto loop1
  391.   }
  392.   set %.fz.num $line(@CDINI,0)
  393.   if (%.fz.num > 0) {
  394.     :loop2
  395.     rline @CDINI %.fz.num $replace($line(@CDINI,%.fz.num),.exe,.ini)
  396.     if ($_vd(.fz.num) > 0) goto loop2
  397.   }
  398.   window -c @Progress
  399.   iline @CDINI 1 - Please double-click on the INI file you wish to use to store CD track info. -
  400.   iline @CDINI 2 $chr(160)
  401.   aline @CDINI $_ppdir $+ cdinfo.dat
  402.   window -ar @CDINI $_center($calc( [ $window(-3).w ] - 100),165) $calc( [ $window(-3).w ] - 100) 165
  403.   halt
  404. }
  405. _finishci {
  406.   set %.line $sline(@CDINI,1).ln
  407.   if (%.line == < 3) halt
  408.   set %cdp.inifile $remove($sline(@CDINI,1),$mircdir)
  409.   disps CD track info will be stored in- %col.info2 $+ $sline(@CDINI,1)
  410.   window -c @CDINI
  411. }
  412. _cdreset unset %_cdp.* %_^cdp.* | if ($_isopen(@CD)) window -n @CD
  413. cdcheck {
  414.   if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11
  415.   if (?: !iswm %cdp.drive) cd d
  416.   if (%cdp.inifile == $null) cd i
  417.   _cdreset
  418.   if (%_cc.repeats < 1) dispa Reading CD info...
  419.   set %.file %cdp.drive $+ \track01.cda
  420.   if ($_not($exists(%.file))) {
  421.     if ($_vi(_cc.repeats) > 5) {
  422.       unset %_cc.repeats
  423.       if ($_isopen(@CD)) window -c @CD
  424.       _error No audio CD found. If one is inserted, please retry command. Note that P&P does not support data CDs with audio tracks.
  425.     }
  426.     .timer920 1 2 cdcheck
  427.     halt
  428.   }
  429.   unset %_cc.repeats
  430.   run -n $_ppdir $+ do-cd.bat $ddename $_ppdir /_cdcfin %cdp.drive
  431. }
  432. _cdcfin {
  433.   .timer920 off
  434.   set %.file $_ppdir $+ cd-temp.txt
  435.   write -il1 %.file 200
  436.   set %_cdp.serial $read -nl1 %.file
  437.   if ((%_cdp.serial == $null) || (%_cdp.serial == x)) { unset %_cdp.serial | _error No audio CD found. If one is inserted, please retry command. Note that P&P does not support data CDs with audio tracks. }
  438.   set %_cdp.tracks $read -nl2 %.file
  439.   set %_cdp.title $_cdi.read(%_cdp.serial,title)
  440.   if (%_cdp.title == $null) set %_cdp.title (unknown)
  441.   set %_cdp.artist $_cdi.read(%_cdp.serial,artist)
  442.   if (%_cdp.artist == $null) set %_cdp.artist (unknown)
  443.   set %.num 1
  444.   :loop
  445.   set %.tr $_cdi.read(%_cdp.serial,$_j(%.num))
  446.   if (%.tr == $null) set %.tr Track %.num
  447.   set %_cdp.tr. [ $+ [ %.num ] ] %.tr
  448.   set %_cdp.time. [ $+ [ %.num ] ] $read -nl [ $+ [ $_i($_vi(.num)) ] ] %.file
  449.   set %.tmp $_j(%.num) $+ . %.tr $+      $+ %_cdp.time. [ $+ [ $_j(%.num) ] ]
  450.   set %_^cdp. [ $+ [ $_j(%.num) ] ] $_a2x(%.tmp)
  451.   if (%.num <= %_cdp.tracks) goto loop
  452.   dispa CD: %col.info1 $+ %_cdp.title $+  by %col.info1 $+ %_cdp.artist $+ , with %col.info1 $+ %_cdp.tracks $+  tracks. %col.option $+ (ShiftF3 to edit CD info)
  453.   if ($_isopen(@CD)) cdview
  454. }
  455. _cdi.read {
  456.   if (.ini isin %cdp.inifile) return $readini -n $_wrapfile(%cdp.inifile) $1 $2
  457.   if ($_not($exists(%cdp.inifile))) return
  458.   set %.tocdr -ns $+ $1 $+ . $+ $2
  459.   return $read %.tocdr $_wrapfile(%cdp.inifile)
  460. }
  461. _cdi.write {
  462.   if (.ini isin %cdp.inifile) writeini $_wrapfile(%cdp.inifile) $1 $2 $3-
  463.   else {
  464.     set %.tocdr $1 $+ . $+ $2
  465.     write -s [ $+ [ %.tocdr ] ] $_wrapfile(%cdp.inifile) %.tocdr $3-
  466.   }
  467. }
  468. cdplay if ($1 == $null) { dispa Running CD player... | cdtrack 1 -q } | else cdtrack $1-
  469. cddrive if ($1 == $null) _askr cddrive Enter the letter of your CD drive- | set %cdp.drive $upper($left($1,1)) $+ : | dispa Drive %col.target $+ %cdp.drive $+  will now be used as your CD drive.
  470. cdedit {
  471.   if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11
  472.   if (?: !iswm %cdp.drive) cd d
  473.   if (%cdp.inifile == $null) cd i
  474.   if (%_cdp.serial == $null) { dispa No CD has been defined- Insert a CD and press %col.option $+ F3 to read it. | halt }
  475.   if ($1 == $null) { cdview | return }
  476.   set %_arhelp cdedit $1
  477.   if ($left($1,1) == t) {
  478.     if ($2 == $null) {
  479.       if ((%_cdp.title == $null) || ($left(%_cdp.title,1) == $chr(40))) _askr _arhelp New title for CD?
  480.       else _pentry _arhelp $+ $_s2p(%_cdp.title) New title for CD?
  481.     }
  482.     set %_cdp.title $2-
  483.     _cdi.write %_cdp.serial title $2-
  484.     if ($_isopen(@CD)) rline @CD 4 CD Title:         $+ %_cdp.title
  485.   }
  486.   elseif ($left($1,1) == a) {
  487.     if ($2 == $null) {
  488.       if ((%_cdp.artist == $null) || ($left(%_cdp.artist,1) == $chr(40))) _askr _arhelp New artist for CD?
  489.       else _pentry _arhelp $+ $_s2p(%_cdp.artist) New artist for CD?
  490.     }
  491.     set %_cdp.artist $2-
  492.     _cdi.write %_cdp.serial artist $2-
  493.     if ($_isopen(@CD)) rline @CD 5 CD Artist:         $+ %_cdp.artist
  494.   }
  495.   elseif (($1 !isnum) || ($1 < 1) || ($1 > %_cdp.tracks)) _error You can only edit the title, artist, or a track number.
  496.   else {
  497.     set %.old %_cdp.tr. [ $+ [ $1 ] ]
  498.     if ($2 == $null) {
  499.       if ((%.old == $null) || ($left(%.old,1) == $chr(40))) _askr _arhelp New track title for track $1 $+ ?
  500.       else _pentry _arhelp $+ $_s2p(%.old) New track title for track $1 $+ ?
  501.     }
  502.     set %_cdp.tr. [ $+ [ $1 ] ] $2-
  503.     set %_^cdp. [ $+ [ $1 ] ] $1 $+ . $2- $+      $+ ( $+ %_cdp.time. [ $+ [ $1 ] ] $+ )
  504.     _cdi.write %_cdp.serial $_j($1) $2-
  505.     if ($_isopen(@CD)) rline @CD $calc(6 + $1) Track %col.target $+ $1 $+ :    ( $+ %_cdp.time. [ $+ [ $1 ] ] $+ )     $+ %_cdp.tr. [ $+ [ $1 ] ]
  506.   }
  507. }
  508. cdview {
  509.   if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11
  510.   window -c @CD
  511.   if (?: !iswm %cdp.drive) cd d
  512.   if (%cdp.inifile == $null) cd i
  513.   if (%_cdp.serial == $null) { dispa No CD has been defined- Insert a CD and press %col.option $+ F3 to read it. | halt }
  514.   window -l $_tabscale(6,10) @CD $_winpos(14%,7%,7%,7%) @CD %font.basic
  515.   titlebar @CD Info
  516.   aline @CD - Double-click will  $+ %cdp.click $+  track -
  517.   aline @CD - Double-click here to play entire CD -
  518.   aline @CD $chr(160)
  519.   aline @CD CD Title:         $+ %_cdp.title
  520.   aline @CD CD Artist:         $+ %_cdp.artist
  521.   aline @CD $chr(160)
  522.   set %.num 1
  523.   :loop
  524.   aline @CD Track %col.target $+ %.num $+ :    ( $+ %_cdp.time. [ $+ [ %.num ] ] $+ )     $+ %_cdp.tr. [ $+ [ %.num ] ]
  525.   if ($_vi(.num) <= %_cdp.tracks) goto loop
  526. }
  527. cdtrack {
  528.   if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11
  529.   if (?: !iswm %cdp.drive) cd d
  530.   if (%cdp.inifile == $null) cd i
  531.   if (%_cdp.serial == $null) { dispa No CD has been defined- Insert a CD and press %col.option $+ F3 to read it. | halt }
  532.   if (($1 !isnum) || ($1 < 1) || ($1 > %_cdp.tracks)) _error You can only play tracks that exist!
  533.   set %.file %cdp.drive $+ \TRACK
  534.   if ($1 < 10) set %.file %.file $+ 0
  535.   set %.file %.file $+ $1 $+ .CDA
  536.   run -n cdplayer -play %.file
  537.   set %.tr %_cdp.tr. [ $+ [ $1 ] ]
  538.   set %.time %_cdp.time. [ $+ [ $1 ] ]
  539.   if ($2 == $null) { dispa Playing track %col.target $+ $1 $+ -  $+ %.tr $+  - %.time | return }
  540.   elseif ($2 == -q) return
  541.   elseif (($_isopen($2)) || ($comchan($2,0) > 0) || ($2 isnotify)) set %.targ $2
  542.   else set %.targ $active
  543.   if (($chan(%.targ) != %.targ) && ($query(%.targ) != %.targ) && ($chat($remove(%.targ,=)) != $remove(%.targ,=))) { dispa Playing track %col.target $+ $1 $+ -  $+ %.tr $+  - %.time | return }
  544.   set %.title %_cdp.title
  545.   if (%.title == $null) set %.title (unknown)
  546.   set %.artist %_cdp.artist
  547.   if (%.artist == $null) set %.artist (unknown)
  548.   if ($left(%_cdp.title,1) == $chr(40)) set %.msg $_getmsg(SoundMsg,CDNoTitle)
  549.   elseif ($left(%_cdp.artist,1) == $chr(40)) set %.msg $_getmsg(SoundMsg,CDNoArtist)
  550.   else set %.msg $_getmsg(SoundMsg,CDNormal)
  551.   describe %.targ $_finalmsg($replace($replace($replace($replace($replace(%.msg,&track&,%.tr),&time&,%.time),&artist&,%.artist),&title&,%.title),&num&,$1))
  552. }
  553. cd {
  554.   if (3.1 isin $os) _error Sorry, the CD player does not work properly on Windows 3.11
  555.   set %.bit $left($1,1)
  556.   if ($1 isnum) cdplay $1-
  557.   elseif (%.bit isin pt) cdplay $2-
  558.   elseif (%.bit == e) cdedit $2-
  559.   elseif (%.bit == v) cdview
  560.   elseif (%.bit == d) cddrive $2-
  561.   elseif (%.bit == i) cdini
  562.   else cdcheck
  563. }
  564. ; -----------------------------------------------------
  565. ; Manually set an autoget
  566. ; command for a user
  567. ; -----------------------------------------------------
  568. autoget {
  569.   if ($1 == -c) { dispa All remembered autoget commands forgotten. | _remcfg Autoget | return }
  570.   if ($2 == $null) _quickhelp /autoget
  571.   set %.lvl.nick $_nickglob($1)
  572.   if (($_ismask($1) == $false) && ($address(%.lvl.nick,5) == $null)) _lookup %.lvl.nick ! autoget , $2-
  573.   if (* isin $1) set %.lvl.addr $1
  574.   else {
  575.     if (@ !isin %.lvl.nick) set %.lvl.nick $address(%.lvl.nick,5)
  576.     set %.lvl.addr $mask(%.lvl.nick,3)
  577.   }
  578.   if ($2 == -c) {
  579.     dispa Clearing autoget command for %col.target $+ %.lvl.addr
  580.     _writecfg AutoGet %.lvl.addr
  581.   }
  582.   else {
  583.     dispa Setting autoget command for %col.target $+ %.lvl.addr $+  to %col.info1 $+ $2-
  584.     _writecfg AutoGet %.lvl.addr $2-
  585.   }
  586. }
  587.